package com.grouuu.keyboard 
{
	import starling.core.Starling;
	import starling.events.EventDispatcher;
	import starling.events.KeyboardEvent;
	
	/**
	 * ...
	 * @author Grouuu
	 */
	public class KeyListener 
	{
		
		public function KeyListener() 
		{
			init();
		}
		
		protected function init():void
		{
			//
		}
		
		public function addListener(listener:IKey):void
		{
			Starling.current.stage.addEventListener(KeyboardEvent.KEY_DOWN, listener.onKeyDown);
			Starling.current.stage.addEventListener(KeyboardEvent.KEY_UP, listener.onKeyUp);
		}
		
		public function removeListener(listener:IKey):void
		{
			Starling.current.stage.removeEventListener(KeyboardEvent.KEY_DOWN, listener.onKeyDown);
			Starling.current.stage.removeEventListener(KeyboardEvent.KEY_UP, listener.onKeyUp);
		}
	}
}